package com.diy.excelsql.common;

/**
 * @author lgf@lianlianton.com
 * @date 2018/11/17
 */
public enum  CardType {
    DEBIT("0","借记卡"),
    CREDIT("1","贷记卡"),
    PREPAID("2","预付费卡"),
    QUASICREDIT("3","准贷记卡");

    private String code;
    private String msg;

    private CardType(String code, String msg) {
        this.msg = msg;
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    //根据Code获取枚举
    public static CardType getEnumByCode(String Code){
        if(null == Code){
            return null;
        }
        for(CardType temp:CardType.values()){
            if(temp.getCode().equals(Code)){
                return temp;
            }
        }
        return null;
    }

    //根据 msg 获取 code
    public static String getCodeByMsg(String Msg){
        if(null == Msg){
            return null;
        }
        for(CardType temp:CardType.values()){
            if(temp.getMsg().equals(Msg)){
                return temp.getCode();
            }
        }
        return null;
    }

}
